$.ajax({
    type:'get',
    url:'/posts/recommend',
    success:function(res){
        console.log(res)
        var tpl = `
        {{each data}}
        <li>
            <a href="javascript:;">
            {{if $value.thumbnail}}
            <img src="{{$value.thumbnail}}" alt="">
            {{else}}
            <img src="uploads/hots_2.jpg" alt="">
            {{/if}}
            <span>{{$value.title}}</span>
            </a>
        </li>
        {{/each}}
        `
        var html = template.render(tpl,{data:res})
        $('.hots ul').html(html)
    }
})